/*
 * @(#)TSTransformer.java
 * Date 2013-02-21
 * Version 1.0
 * Author Jim Horner
 * Copyright (c)2012
 */


package us.hornerscorners.lamppost.hl7v3common.transformer;

import javax.enterprise.context.ApplicationScoped;

import org.hl7.v3.TS;

import org.joda.time.DateTime;

import us.hornerscorners.lamppost.hl7v3common.utils.HL7Utils;

import us.hornerscorners.lamppost.transformer.AbstractTransformer;


/**
 *
 * @author jim
 */
@ApplicationScoped
public class TSTransformer extends AbstractTransformer<DateTime, TS> {

    /**
     * Constructs ...
     *
     */
    public TSTransformer() {
        super();
    }

    /**
     * Method description
     *
     *
     * @return
     */
    public TS createNowTS() {

        return transform(DateTime.now());
    }

    /**
     * Method description
     *
     *
     * @param date
     *
     * @return
     */
    @Override
    public TS transform(DateTime date) {

        TS result = new TS();

        result.setValue(HL7Utils.toUTCDateTimeString(date));

        return result;
    }
}
